﻿using PSI.Helper;
using PSI.Models.TMS;
using PSI.Services;
using PSI.Services.TMS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace PSI.Controllers {
    public class FuelController : PSIController {
        public ActionResult Index() {
            var ps = new PermissionService();

            if (!ps.HasPermission(FIdConst.FUEL)) {
                return Redirect("/");
            }

            ViewBag.UserName = UserService.GetLoginUserName();

            return View();
        }

        [HttpPost]
        public ActionResult GetFuelListData() {
            var data = new FuelService().GetFuelListData();

            return Json(data);

        }

        [HttpPost]
        public ActionResult Edit(Fuel fuel) {
            var result = new FuelService().Edit(fuel);

            return Json(result);
        }

        [HttpPost]
        public ActionResult Delete(string id) {
            var result = new FuelService().Delete(id);

            return Json(result);
        }
    }
}
